package com.petot.claude.gwtc.client;

import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.Focusable;

public abstract class PageAbstractView<D extends PageAbstractView.Delegate> extends Composite {
    /**
     * Implémented by the view's owner
     */
    public interface Delegate {
    }

    /**
     * Delegate for events management
     */
    protected D delegate;

    public PageAbstractView() {
        buildView();
    }

    /**
     * View building
     */
    protected abstract void buildView();

    /**
     * Le widget sur lequel sera mis le focus à l'affichage de la page.
     * Peut être null si on ne veut focuser aucun widget
     * @return
     */
    public abstract Focusable getFocusedWidget();

    public final void setDelegate( final D pDelegate ) {
        this.delegate = pDelegate;
    }
}
